﻿using System;
using wojilu.Apps.Qycms.Domain;
using wojilu.Web.Mvc.Attr;

namespace wojilu.Web.Controller
{
    public class OtherController : BaseTempController
    {
        public OtherController()
        {
            LayoutControllerType = typeof(wojilu.Web.Controller.YBBSiteInitController);
        }

        [NonVisit]
        public virtual void setpublic()
        {
            set("top", loadHtml(new PublicController().Top));
            set("bottom", loadHtml(new PublicController().Bottom));
        }

        [HttpGet]
        public virtual void Link(Int64 Id)
        {
            view(DefaultTemp + "Public/Link");




            setpublic();
            SetPublic();
        }

        [HttpGet]
        public virtual void CallMessage()
        {
            view(DefaultTemp + "Public/CallMessage");

            //标题、关键词、描述
            var Title = String.Empty;
            var Keywords = String.Empty;
            var Description = String.Empty;
            var Position = String.Empty;

            var Lngs = CurrentLng;

            Title = YBBCommon.GetLangStr(Lngs, "message");
            Keywords = YBBCommon.GetLangStr(Lngs, "keyword");
            Description = YBBCommon.GetLangStr(Lngs, "description");

            ctx.Page.SetTitle(Title);
            ctx.Page.Keywords = Keywords;
            ctx.Page.Description = Description;

            var linkurl = string.Empty;
            var backlinkurl = string.Empty;
            var calltitle = string.Empty;
            var backbotton = string.Empty;
            var bottonname = string.Empty;
            var backid = 0;

            var errorType = ctx.web.SessionGet("errorType").ObjectToInt();
            var Tid = ctx.web.SessionGet("Tid").ObjectToInt();
            var Id = ctx.web.SessionGet("Id").ObjectToInt();
            switch (errorType)
            {
                case 1:  //会员权限
                    linkurl = UrlLinkHelp.GetMemberLoginLink(Lngs);
                    backlinkurl = UrlLinkHelp.GetMemberRegLink(Lngs);
                    calltitle = YBBCommon.GetLangStr(Lngs, "memberloginerr");
                    backbotton = YBBCommon.GetLangStr(Lngs, "member_regbotton");
                    bottonname = YBBCommon.GetLangStr(Lngs, "memberlogin");
                    backid = 1;
                    break;

                case 2:
                    linkurl = "javascript:history.go(-1)";
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "seescodeerr");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "gobackbotton");
                    break;

                case 3:
                    linkurl = UrlLinkHelp.GetForumLink(Tid, DefaultLng, Lngs);
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "forum_input_filter");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "gobackbotton");
                    break;

                case 4:
                    linkurl = UrlLinkHelp.GetForumLink(Tid, DefaultLng, Lngs);
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "forum_input_ok");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "gobackbotton");
                    break;

                case 5:
                    linkurl = UrlLinkHelp.GetForumLink(Tid, DefaultLng, Lngs);
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "forum_mem_username");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "gobackbotton");
                    break;

                case 6:
                    linkurl = UrlLinkHelp.GetForumLink(Tid, DefaultLng, Lngs);
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "repeatinput");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "gobackbotton");
                    break;

                case 7:
                    linkurl = UrlOper.GetRefererUrl();
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "search_list_no");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "gobackbotton");
                    break;

                case 8:
                    linkurl = UrlLinkHelp.GetArticleReadLink(DefaultLng, Lngs, Id);
                    backlinkurl = UrlLinkHelp.GetEnquryListLink(Lngs);
                    calltitle = YBBCommon.GetLangStr(Lngs, "enqiry_into_ok");
                    backbotton = YBBCommon.GetLangStr(Lngs, "enquiry_into_listbotton");
                    bottonname = YBBCommon.GetLangStr(Lngs, "enquiry_into_goback");
                    backid = 1;
                    break;

                case 9:
                    linkurl = UrlOper.GetRefererUrl();
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "enqiry_into_err");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "gobackbotton");
                    break;

                case 10:
                    linkurl = UrlLinkHelp.GetEnquryListLink(Lngs);
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "enquiry_cleargoods");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "enquiry_into_goback");
                    break;

                case 11:
                    linkurl = UrlLinkHelp.GetEnquryListLink(Lngs);
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "enquiry_delok");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "enquiry_into_listbotton");
                    break;

                case 12:
                    linkurl = "javascript:history.go(-1)";
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "enquiry_input_err");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "gobackbotton");
                    break;

                case 13:
                    linkurl = UrlLinkHelp.GetEnquryListLink(Lngs);
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "enquiry_ok");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "enquiry_into_listbotton");
                    break;

                case 14:
                    linkurl = UrlOper.GetRefererUrl();
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "zhaoshangjoin");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "gotoshangjoin");
                    break;

                case 15:
                    linkurl = "javascript:history.go(-1)";
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "zhaoshangjoinno");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "gobackbotton");
                    break;

                case 16:
                    linkurl = UrlLinkHelp.GetHomeLink(DefaultLng, Lngs);
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "vote_mess_ok");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "gobackurlbotton");
                    break;

                case 17:
                    linkurl = "javascript:history.go(-1)";
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "vote_mess_no");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "gobackbotton");
                    break;

                case 18:
                    linkurl = "javascript:history.go(-1)";
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "seescodeerr");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "gobackbotton");
                    break;

                case 19: //是否开启会员频道
                    linkurl = UrlOper.GetRefererUrl();
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "mem_close");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "gobackbotton");
                    break;

                case 20:
                    linkurl = UrlLinkHelp.GetMemberLoginLink(Lngs);
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "member_memlock");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "gobackbotton");
                    break;

                case 21:
                    linkurl = UrlLinkHelp.GetMemberLoginLink(Lngs);
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "login_err");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "gobackbotton");
                    break;

                case 22:
                    linkurl = UrlLinkHelp.GetMemberLoginLink(Lngs);
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "member_lock");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "gobackbotton");
                    break;

                case 23:
                    linkurl = UrlLinkHelp.MemberMailSend(Lngs, Id); 
                    backlinkurl = UrlLinkHelp.GetMemberLoginLink(Lngs);
                    calltitle = YBBCommon.GetLangStr(Lngs, "username_check");
                    backbotton = YBBCommon.GetLangStr(Lngs, "gobackurlbotton");
                    bottonname = YBBCommon.GetLangStr(Lngs, "checkemail_send");
                    backid = 1;
                    break;

                case 24:
                    linkurl = UrlLinkHelp.GetMemberLoginLink(Lngs);
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "username_sendmail_err");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "gobackbotton");
                    break;

                case 25:
                    linkurl = UrlLinkHelp.GetMemberLoginLink(Lngs);
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "username_sendmail_ok");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "gobackbotton");
                    break;

                case 26:
                    linkurl = UrlLinkHelp.GetMemberLoginLink(Lngs);
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "username_check_ok");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "gobackbotton");
                    break;

                case 27:
                    linkurl = UrlLinkHelp.GetMemberLoginLink(Lngs);
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "username_check_no");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "gobackbotton");
                    break;

                case 28:
                    linkurl = ctx.web.CookieGet("LoginRefererUrl"); 
                    backlinkurl = UrlLinkHelp.GetMemberCenterLink(Lngs);
                    calltitle = YBBCommon.GetLangStr(Lngs, "login_ok");
                    backbotton = YBBCommon.GetLangStr(Lngs, "member_center_botton");
                    bottonname = YBBCommon.GetLangStr(Lngs, "gobackurlbotton");
                    backid = 1;
                    break;

                case 29:
                    linkurl = UrlLinkHelp.GetMemberCenterLink(Lngs);
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "member_edit_ok");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "gobackurlbotton");
                    break;

                case 30:
                    linkurl = UrlOper.GetRefererUrl();
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "password_input_err");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "gobackbotton");
                    break;

                case 31:
                    linkurl = UrlLinkHelp.GetMemberLoginLink(Lngs);
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "password_ok");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "gobackurlbotton");
                    break;

                case 32:
                    linkurl = UrlLinkHelp.GetMemberCenterLink(Lngs);
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "email_edit_ok");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "gobackurlbotton");
                    break;

                case 33:
                    linkurl = UrlLinkHelp.EnquiryMainList(Lngs); 
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "enquiry_edit_del");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "gobackurlbotton");
                    break;

                case 34:
                    linkurl = UrlLinkHelp.EnquiryMainList(Lngs); 
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "enquiry_memberinfoedit_ok");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "gobackurlbotton");
                    break;

                case 35:
                    var refererurl = UrlOper.GetRefererUrl();
                    if (refererurl == null)
                    {
                        linkurl = UrlOper.GetRefererUrl();
                    }
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "memberpuverr");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "gobackurlbotton");
                    break;

                case 36:
                    linkurl = UrlOper.GetRefererUrl();
                    backlinkurl = UrlLinkHelp.GetMemberCenterLink(Lngs);
                    calltitle = YBBCommon.GetLangStr(Lngs, "login_ok");
                    backbotton = YBBCommon.GetLangStr(Lngs, "member_center_botton");
                    bottonname = YBBCommon.GetLangStr(Lngs, "gobackurlbotton");
                    backid = 1;
                    break;

                case 37:
                    linkurl = UrlOper.GetRefererUrl();
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "reg_err");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "gobackbotton");  //返回重新填写
                    break;

                case 38:
                    linkurl = UrlLinkHelp.GetMemberLoginLink(Lngs);
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "password_lostok");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "memberlogin");
                    break;

                case 39:
                    linkurl = UrlOper.GetRefererUrl();
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "password_losterr");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "gobackurlbotton");//返回默认地址
                    break;

                case 40:
                    linkurl = UrlOper.GetRefererUrl();
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "search_err");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "gobackurlbotton");//返回默认地址
                    break;

                case 41:
                    linkurl = UrlOper.GetRefererUrl();
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "member_lock");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "gobackurlbotton");//返回默认地址
                    break;

                case 42:
                    linkurl = UrlLinkHelp.GetFormListLink(Lngs, Tid);
                    backlinkurl = "";
                    calltitle = YBBCommon.GetLangStr(Lngs, "repeatinput");
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "gobackbotton");
                    break;

                case 43:
                    //linkurl = UrlLinkHelp.GetFormListLink(Lngs, Tid);
                    linkurl = UrlOper.GetRefererUrl();
                    backlinkurl = "";
                    Form_Group model = Form_Group.findById(Tid);
                    if (model == null)
                    {
                        calltitle = YBBCommon.GetLangStr(Lngs, "forum_input_ok");
                    }
                    else
                    {
                        calltitle = model.successtext;
                    }
                    backbotton = "";
                    bottonname = YBBCommon.GetLangStr(Lngs, "gobackbotton");
                    break;
            }
            set("title", Title);
            set("linkURL", linkurl);
            set("backlinkURL", backlinkurl);
            set("calltitle", calltitle);
            set("backBotton", backbotton);
            set("bottonName", bottonname);
            set("backid", backid);
            setpublic();
            SetPublic();
        }

    }
}
